package name.williamwall.buxoid;
/**
 * This software is made available under the Gnu General Public License v3
 * and has absolutely no waranty. You may change the software to suit your needs.
 * 
 * Author: William Wall, IV
 */
import java.text.NumberFormat;

import android.content.Context;
import android.database.Cursor;
import android.widget.SimpleCursorAdapter;
import android.widget.TextView;

public class ImpactAdapter extends SimpleCursorAdapter {
	private static NumberFormat moneyFormat = NumberFormat.getCurrencyInstance();
	
	public ImpactAdapter(Context context, int layout, Cursor c, String [] from, int [] to) {
		super(context, layout, c, from, to);
		moneyFormat.setCurrency(Buxoid.mDb.getCurrency());
	}

	@Override
	public void setViewText(TextView v, String text) {
		if (v.getId() == R.id.row_impact_amount) {
			v.setText(moneyFormat.format(Double.parseDouble(text)));
		} else {
			v.setText(text);
		}
	}
}
